package com.wbl.train.business.controller;

import com.wbl.train.business.service.TrainService;
import com.wbl.train.common.business.vo.TrainVo;
import com.wbl.train.common.result.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
    import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 王博纶
 * @since 2024-02-01
 * @description 车次
 */
@Slf4j
@AllArgsConstructor
@RestController
@RequestMapping("/train")
@Tag(name = "车次控制器类",
        description = "TrainController 车次 后端数据接口")
public class TrainController {
    private final TrainService trainService;

    /**
     * 通过id查询 火车车次
     * @return Result
     */
    @Operation(summary = "通过id查询", description = "通过id查询")
    @GetMapping("/query_all")
    public R<List<TrainVo>> getAll() {
        List<TrainVo> trainVos = trainService.queryAllTrain();
        return R.ok("查询成功",trainVos);
    }
}
